//
// Created by Winter on 2021/1/29.
//

#include "BaseScaleUtil.h"

double BaseScaleUtil::scale() {
    QRect deskRect = getDeskRect();
    if (deskRect.height() < 800) {
        return 0.73;
    } else if (deskRect.height() <= 1080) {
        return 1.0;
    } else {
        return deskRect.height() / 1080.0;
    }
}

int BaseScaleUtil::fontSizeScale(int size) {
    int sizeAfterScale = size * BaseScaleUtil::scale();
    return sizeAfterScale;
}

QRect BaseScaleUtil::getDeskRect() {
    QDesktopWidget *desktopWidget = QApplication::desktop();
    //获取可用桌面大小
    QRect deskRect = desktopWidget->availableGeometry();

    return deskRect;
}

